package com.changli01.file.exer1;

import java.io.File;
import java.io.IOException;

public class Exer1 {
    public static void main(String[] args) {
        File file1 = new File("D:\\后端\\File_ioStream\\hello.txt");
        if(!file1.exists()){
            boolean newFile = false;
            try {
                newFile = file1.createNewFile();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            System.out.println(newFile?"创建成功":"创建失败");
        }
        String path = file1.getAbsoluteFile().getParent();
        File file2 = new File(path+"\\abc.txt");
        if(!file2.exists()){
            try {
                file2.createNewFile();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
